package com.esun.payment_api.controller;

import com.esun.common.api.CommonPage;
import com.esun.common.api.CommonResult;
import com.esun.payment_api.bean.WldwBean;
import com.esun.payment_api.service.SysCustomerService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

@RestController
@RequestMapping("/sysCustomer")
public class SysCustomerController {

    @Resource
    SysCustomerService sysCustomerService;

    /**
     * 获取所有往来单位列表
     */
    @GetMapping("/getWldwList")
    public CommonResult getWldwList(String searchStr,
                                    @RequestParam(value = "coId", defaultValue = "22") Integer coId,
                                    @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize,
                                    @RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum) {

        List<WldwBean> list = sysCustomerService.getWldwList(searchStr, coId, pageSize, pageNum);
        return CommonResult.success(CommonPage.restPage(list));
    }

}
